/*
 * Range.java
 *
 * Created on 14 March 2007, 02:26
 */

package net.siit.datatype;

/**
 *
 * @author art
 */
public class Range implements Comparable<Range> {
    private int start;
    private int end;
    
    // most left, longest
    @Override
    public int compareTo(Range o) {
        int diff = this.start - o.start;    // most left
        if (diff != 0) return diff;
        return diff = o.end - this.end;
    }
    
    public Range() {
        this.start = 0;
        this.end   = 0;
    }
    
    public Range(int start, int end) {
        this.start = start;
        this.end   = end;
    }
    
    public int getStart() {
        return start;
    }
    
    public int getEnd() {
        return end;
    }
    
    public void setStart(int start) {
        this.start = start;
    }
    
    public void setEnd(int end) {
        this.end = end;
    }
    
    public int lenght() {
        return end-start;
    }
    
    @Override
    public String toString() {
        return ("[" + start + "," + end + "]");
    }   
    
}
